<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: 'ikun',
            age: 32,
            hobby: ['讲课', '敲代码', '黑马程序员'],
            class: {
                name: '长沙大前端',
                salary: [18888, 15555, 44444]
            }
        }
        // 深拷贝方法一：
        // json方法，实际开发中常用：把js对象转成json，然后再转成js，就能实现深拷贝
        let json = JSON.stringify(obj)//编译器底层会深拷贝
        let js = JSON.parse(json)
        console.log(js === obj)//false
        //简写
        let json1 = JSON.parse(JSON.stringify(obj))
        console.log(json1);
    </script>
</body>

</html>